/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package VectorMathTests;

import GameEngine.GameConstants.Graphic;
import GameEngine.Vector;
import LevelEditor.EditorFunctions;
import Objects.GameObject;

/**
 *
 * @author jh20
 */
public class TestThree {

    public static void main(String[] args) {
        // basic
        GameObject obj = new GameObject(new Vector(1,0), new Vector(0,0), new Vector(4,4), Graphic.FAN);
        Vector[] result = obj.getCorners();
        System.out.println("results : ");
        for (Vector corner: result) {
            System.out.println(corner.getX() + ", " + corner.getY());
        }
        System.out.println("should be : ");
        Vector[] expectedResult = {new Vector(-2, -2), new Vector(-2, 2), new Vector (2, -2), new Vector(2, 2)};
        for (Vector corner: expectedResult) {
            System.out.println(corner.getX() + ", " + corner.getY());
        }
        System.out.println("order doesn't matter");
        System.out.println("==============================================");

        // now try diagonal/negative/uneven sides
        obj = new GameObject(new Vector((1/Math.sqrt(2)), (-1/Math.sqrt(2))), new Vector(3,-2), new Vector(8,4), Graphic.FAN);
        result = obj.getCorners();
        System.out.println("results : ");
        for (Vector corner: result) {
            System.out.println(corner.getX() + ", " + corner.getY());
        }
        System.out.println("should be : ");
        Vector[] expectedResult2 = new Vector[4];
        expectedResult2[0] = new Vector(3-4/Math.sqrt(2)+2/Math.sqrt(2), -2+4/Math.sqrt(2)+2/Math.sqrt(2));
        expectedResult2[1] = new Vector(3-4/Math.sqrt(2)-2/Math.sqrt(2), -2+4/Math.sqrt(2)-2/Math.sqrt(2));
        expectedResult2[2] = new Vector(3+4/Math.sqrt(2)+2/Math.sqrt(2), -2-4/Math.sqrt(2)+2/Math.sqrt(2));
        expectedResult2[3] = new Vector(3+4/Math.sqrt(2)-2/Math.sqrt(2), -2-4/Math.sqrt(2)-2/Math.sqrt(2));

        for (Vector corner: expectedResult2) {
            System.out.println(corner.getX() + ", " + corner.getY());
        }
        System.out.println("order doesn't matter");
        System.out.println("==============================================");
    }

}
